package defaulPackage;
import java.util.List;

import estrategia_Marcos.LimitFile;

public class Facade {
	
	public void create(User user){
		RegisterUser register = RegisterUser.getInstance();
		register.addUser(user);
	}
	
	public void allUsers(){
		RegisterUser register = RegisterUser.getInstance();
		System.out.println("All Users: "+register.getUsers());
	}
	
	public void login(Login login){
		RegisterUser register = RegisterUser.getInstance();
		if (register.login(login)){
			System.out.println("Login com sucesso!");
		}else{
			System.out.println("Usuario ou senha invalido!");
		}
	}
	
	public void setTypeLimit(User user, LimitFile limit) {
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		profile.setLimitFile(limit);
	}

	public void pay(User user) {
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		profile.pay();
	}
	
	public void addFile(User user, File file){
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		profile.addFile(file);
	}
	
	public void musicProfile(User user){
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		System.out.println("Musica ("+profile.getNick()+"): "+profile.getMusics());
	}		
	
	public void videoProfile(User user){
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		System.out.println("Video ("+profile.getNick()+"): "+profile.getVideos());
	}	
	
	public void photoProfile(User user){
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		System.out.println("Foto ("+profile.getNick()+"): "+profile.getPhotos());
	}	
	
	public void searchFile(User user, File file){
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		List<File> search = profile.search(file);
		System.out.println("Arquivos encontrado: "+search);
	}
	
	public void addFriend(User user, Profile pro){
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		profile.addFriend(pro);
	}
	
	public void friends(User user){
		RegisterUser register = RegisterUser.getInstance();
		Profile profile = register.searchProfile(user);
		System.out.println("Amigo ("+profile.getNick()+"): "+profile.getFriends());
	}
	
	public void addBand(User user, Band band){
		user.createBand(band);
	}
	
	public void getMembers(User user){
		System.out.println("Integrantes ("+user.getBand().getName()+"): "+user.getBand().getMembers());
	}

	public void createTopic(Topic topic) {
		Forum forum = Forum.getInstance();
		forum.createTopic(topic);
	}

	 void getReplies(Topic topic) {
		System.out.println("Resposta ("+topic.getTitle()+"): "+topic.getReplies());
		
	}

	public void allTopics() {
		Forum forum = Forum.getInstance();
		System.out.println("Todos os topicos: "+forum.getTopics());
	}

	public void searchTopic(User user) {
		Forum forum = Forum.getInstance();
		List<Topic> searchTopic = forum.searchTopic(user.getProfile());
		if (searchTopic.isEmpty()){
			System.out.println("Topico não encontrado");
		}else{
			System.out.println("Topico encontrado: "+searchTopic);
		}
	}


	
}
